home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / os2 / pc2_140.zip / INSTALL.CMD next >
OS/2 REXX Batch file  |  1993-04-14  |  12KB  |  253 lines

  1. /***********************************************************************\
  2.  *                                 PC2.c                               *
  3.  *                 Copyright (C) by Stangl Roman, 1993                 *
  4.  * This Code may be freely distributed, provided the Copyright isn't   *
  5.  * removed.                                                            *
  6.  *                                                                     *
  7.  * Install.cmd  Installation batch file.                               *
  8.  *                                                                     *
  9.  *              INSTALL <InstallationPathDirectory>                    *
  10.  *              F.e. INSTALL C:\PMAPPS\PC2                             *
  11.  *                                                                     *
  12.  *              The PC/2 Package is installed in the Path pointed      *
  13.  *              by <InstallationPathDirectory> from the current path.  *
  14.  *                                                                     *
  15. \***********************************************************************/
  16.  
  17. /* static char RCSID[]="@(#) $Header: Install.cmd Version 1.40 04,1993 $ (LBL)" */
  18.  
  19.                                         /* Register REXX APIs */
  20. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  21. Call SysLoadFuncs
  22.  
  23. Parse Arg InstallationPathDirectory     /* Command line parameter */
  24. Signal On Halt Name SignalHandler       /* Exception handler */
  25. Call DisplayLogo                        /* Display logo panel */
  26.                                         /* Query the current path and directory */
  27. CurrentPathDirectory=SysSearchPath("Path", "Install.cmd")
  28.                                         /* Installation path must be given */
  29. Do While InstallationPathDirectory=" "
  30.     Call DisplayLogo                    /* Display logo panel */
  31.     Say "                       PC/2 Installation Instruction:"
  32.     Say
  33.     Say " To install PC/2, you must provide a target path to install PC/2 into."
  34.     Say
  35.     Say " Syntax:       INSTALL <InstallationPathDirectory>"
  36.     Say
  37.     Say " Example:      INSTALL C:\PMAPPS\PC2"
  38.     Say
  39.     Parse Value SysCurPos() with Row Col
  40.     Say " Please input: "
  41.     Col=Col+15
  42.     Call SysCurPos Row, Col
  43.     Pull InstallationPathDirectory
  44. End
  45. Call DisplayLogo                        /* Display logo panel */
  46.  
  47.                                         /* Test for installation directory */
  48. Call SysFileTree InstallationPathDirectory, FileDirectory, 'D'
  49. If FileDirectory.0='0' Then Do
  50.                                         /* Make the installation directory */
  51.     rc=SysMkDir(InstallationPathDirectory)
  52.     If rc\=0 Then Do
  53.         Say " Sorry, the desired directory couldn't be created - exiting..."
  54.         Exit
  55.     End
  56. End
  57.  
  58.                                         /* Now copy files */
  59. Say
  60. Say " Now copying files..."
  61. Call FileCopy 'PC2.exe', InstallationPathDirectory
  62. Call FileCopy 'PC2.hlp', InstallationPathDirectory
  63. Call FileCopy 'PC2*.cfg', InstallationPathDirectory
  64. Call FileCopy 'PC2Hook.dll', InstallationPathDirectory
  65. Call FileCopy 'PC2.doc', InstallationPathDirectory
  66. Call FileCopy 'PC2.faq', InstallationPathDirectory
  67. Call FileCopy 'Makefile', InstallationPathDirectory
  68. Call FileCopy 'Install.cmd', InstallationPathDirectory
  69. Call FileCopy 'MakeObj.cmd', InstallationPathDirectory
  70. Call FileCopy 'Source.zip', InstallationPathDirectory
  71. Call DisplayLogo                        /* Display logo panel */
  72.  
  73.                                         /* Ask the user if he wants to display the Popup-
  74.                                            Menu after a single-click instead of a double-
  75.                                            click with mouse button 1 */
  76. Say " Do you want the Popup-Menu displayed after a single-click with mouse button 1"
  77. Parse Value SysCurPos() with Row Col
  78. Say " instead of the default double click? [Y/y/N/n]: "
  79. Col=Col+49
  80. Call SysCurPos Row, Col
  81. Pull SingleClickFlag
  82. Say
  83. If SingleClickFlag='Y' | SingleClickFlag='y' Then Do
  84.                                         /* Add -SingleClick to the parameters field */
  85.     SetupString="EXENAME="InstallationPathDirectory"\PC2.EXE;STARTUPDIR="InstallationPathDirectory";PARAMETERS=-SingleClick"
  86. End
  87. else Do
  88.                                         /* Add -DoubleClick to the parameters field */
  89.     SetupString="EXENAME="InstallationPathDirectory"\PC2.EXE;STARTUPDIR="InstallationPathDirectory";PARAMETERS=-DoubleClick"
  90. End
  91.                                         /* Now create the PC/2 object on the Desktop */
  92. rc=SysCreateObject("WPProgram",,
  93.                    "PC/2",,
  94.                    "<WP_DESKTOP>",,
  95.                    SetupString)
  96. If rc=0 Then Do
  97.     Say " Sorry, PC/2 couldn't be created as a WPS object - exiting..."
  98.     Exit
  99. End
  100.  
  101. If Substr(InstallationPathDirectory, 2, 1)=":" Then Do
  102.                                         /* Change to the drive where we copied files to */
  103.     Command="@"Filespec("Drive", InstallationPathDirectory)" >NUL"
  104.     Command
  105. End
  106.                                         /* Change in the directory */
  107. Command="@CD "InstallationPathDirectory" >NUL"
  108. Command
  109.                                         /* Now we start PC/2 with help, but check for
  110.                                            the clicking method */
  111. If SingleClickFlag='Y' | SingleClickFlag='y' Then Do
  112.     Command="@Start PC2.exe -SingleClick -INSTALL >NUL"
  113. End
  114. else Do
  115.     Command="@Start PC2.exe -DoubleClick -INSTALL >NUL"
  116. End
  117. Command
  118. If rc\=0 Then Do
  119.     Say " Sorry, I couldn't start PC/2 for you..."
  120. End
  121. Else Do
  122.     Say " After you have finished reading all help panels exit PC/2 and restart it by"
  123.     Say " clicking on the Desktop with mouse button 1. You will notice that the back-"
  124.     Say " ground behind the icon changed its color and shape if PC/2 is started."
  125. End
  126. Say
  127.                                         /* Now search for CONFIG.SYS and the statement
  128.                                            SET RESTARTOBJECTS=STARTUPFOLDERSONLY */
  129. FoundConfig=FALSE
  130. SearchConfig="C:\CONFIG.SYS D:\CONFIG.SYS E:\CONFIG.SYS F:\CONFIG.SYS G:\CONFIG.SYS"
  131. Do Temp=1 to Words(SearchConfig)
  132.     Call SysFileSearch "STARTUPFOLDERSONLY", Word(SearchConfig, 1), LinesCount
  133.     If LinesCount.0\=0 Then FoundConfig=TRUE
  134. End
  135.                                         /* Inform the user about CONFIG.SYS */
  136. If FoundConfig=TRUE Then Do
  137.     Say " You have the statement SET RESTARTOBJECTS=STARTUPFOLDERSONLY in your"
  138.     Say " Config.Sys. To enable OS/2 to start PC/2 during boot, you have to create"
  139.     Say " a shadow of PC/2 and move it into your startup folder."
  140. End
  141. Else Do
  142.     Say " You don't have the statement SET RESTARTOBJECTS=STARTUPFOLDERSONLY in ypur"
  143.     Say " Config.Sys. OS/2 will start automatically PC/2 during next boot, if PC/2 is"
  144.     Say " active before you Shutdown your System."
  145. End
  146. Say
  147. Say " Press Enter to continue!..."
  148. Pull Ignore
  149. Call DisplayLogo                        /* Display logo panel */
  150.                                         /* Now search for CONFIG.SYS and the statement
  151.                                            SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE */
  152. FoundConfig=FALSE
  153. SearchConfig="C:\CONFIG.SYS D:\CONFIG.SYS E:\CONFIG.SYS F:\CONFIG.SYS G:\CONFIG.SYS"
  154. Do Temp=1 to Words(SearchConfig)
  155.     Call SysFileSearch "SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE", Word(SearchConfig, 1), LinesCount
  156.     If LinesCount.0\=0 Then FoundConfig=TRUE
  157. End
  158.                                         /* Inform the user about CONFIG.SYS */
  159. If FoundConfig=TRUE Then Do
  160.     Say " You have the statement SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE in your"
  161.     Say " Config.Sys. You may replace the WPS by PC/2, please look into the help-"
  162.     Say " panels of PC/2 for further information."
  163. End
  164. Else Do
  165.     Say " It seems that you don't run the WPS (WorkPlace Shell). You may use PC/2 as"
  166.     Say " a replacement for the WPS by adding to or modifying your CONFIG.SYS:"
  167.     Say " SET RUNWORKPLACE="InstallationPathDirectory"\PC2.EXE"
  168.     Say " But be sure that PC2HOOK.DLL and PC2.HLP are in a path pointed to by the"
  169.     Say " LIBPATH and HELP environment variable (the '.;' statement is not"
  170.     Say " sufficient) or in the directory of PC/2. Please look into the help panels"
  171.     Say " of PC/2 for further information."
  172. End
  173. Say
  174. Say " Press Enter to continue!..."
  175. Pull Ignore
  176. Call DisplayLogo                        /* Display logo panel */
  177.                                         /* Inform the user about safety an fee */
  178. Say " Don't forget to backup your configuration file regularily to avoid possible"
  179. Say " damages to your configuration file."
  180. Say
  181. Say " If you find this utility useful and want to honor four weeks of work, you are"
  182. Say " welcome to send me a small fee. Please read the documentation for further"
  183. Say " information - Thank you!"
  184. Say
  185. Parse Value SysCurPos() with Row Col
  186. Say " Do you want to read the FAQ (Frequently Asked Questions) list? [Y/y/N/n]: "
  187.                                         /* Ask the user if he wants to read the FAQ */
  188. Col=Col+75
  189. Call SysCurPos Row, Col
  190. Pull FAQFlag
  191. If FAQFlag='Y' | FAQFlag='y' Then Do
  192.     Call SysCls
  193.     Command="@Type PC2.faq |more"
  194.     Command
  195. End
  196. Say
  197. Say "   And now - enjoy! - And now - enjoy! - And now - enjoy! - And Now - enjoy!"
  198.                                         /* Change to the drive where we installed from */
  199. Command="@"Filespec("Drive", CurrentPathDirectory)" >NUL"
  200. Command
  201.                                         /* Change in the directory */
  202. Command="@CD "Strip(Filespec("Path", CurrentPathDirectory), T, "\")" >NUL"
  203. Command
  204. Exit
  205.  
  206. /*--------------------------------------------------------------------------------------*\
  207.  * Copy files from current directory to destination directory                           *
  208.  * Req:                                                                                 *
  209.  *      FileName ...... File to copy                                                    *
  210.  *      Destination ... Destination directory                                           *
  211.  * Returns:                                                                             *
  212.  *      none                                                                            *
  213. \*--------------------------------------------------------------------------------------*/
  214. FileCopy: Arg FileName, Destination
  215.     
  216. Command='@Copy 'FileName' 'Destination' >NUL'
  217. Command
  218. If rc\=0 Then Do
  219.     Say "Sorry, the files couldn't be copied - exiting..."
  220.     Exit
  221. End
  222. Return
  223.  
  224. /*--------------------------------------------------------------------------------------*\
  225.  * Display the logo lines                                                               *
  226.  * Req:                                                                                 *
  227.  *      none                                                                            *
  228.  * Returns:                                                                             *
  229.  *      none                                                                            *
  230. \*--------------------------------------------------------------------------------------*/
  231. DisplayLogo:
  232. Call SysCls
  233. Say
  234. Say
  235. Say "                 PC/2 - Program Commander/2 Version 1.40 for"
  236. Say "                       IBM OS/2 2.x Presentation Manager"
  237. Say "                    Copyright (C) by Stangl Roman 04, 1993"
  238. Say
  239. Return
  240.  
  241. /*--------------------------------------------------------------------------------------*\
  242.  * The signal handler to exit after an exception                                        *
  243.  * Req:                                                                                 *
  244.  *      none                                                                            *
  245.  * Returns:                                                                             *
  246.  *      none                                                                            *
  247. \*--------------------------------------------------------------------------------------*/
  248. SignalHandler:
  249. Call SysCls
  250. Say "PC/2 abnormal error - exiting..."
  251. Exit
  252.  
  253.